package com.yjd.pub.credit.service;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.comm.credit.model.CreditLineDataModel;
import com.yjd.comm.credit.service.ICreditLineDataService;
import com.yjd.pub.credit.dao.ICreditLineDataDao;

/**
 * <b>description</b>：用户信用额度使用流水业务实现<br>
 * <b>time</b>：2017-06-26 13:48:05 <br>
 * <b>author</b>：  yangchangyan@yijiedai.com
 */
@Service("creditLineDataService")
public class CreditLineDataServiceImpl extends BaseServiceImpl implements ICreditLineDataService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public CreditLineDataModel insert(CreditLineDataModel model) throws Exception {
		return this.creditLineDataDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(CreditLineDataModel model) throws Exception {
		return this.creditLineDataDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int delete(long id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("id", id);
		return this.creditLineDataDao.deleteModel(paramMap, true);
	}

	@Resource
	private ICreditLineDataDao creditLineDataDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.creditLineDataDao;
	}

}
